package com.winchain.provider.expiration.cmd;

import com.shell.framework.command.CommandContext;
import com.shell.framework.command.ICommand;
import com.winchain.chainbill.bill.base.po.CbOpt;
import com.winchain.chainbill.bill.base.po.CbRec;
import com.winchain.chainbill.bill.biz.Bill;
import com.winchain.chainbill.bill.biz.receive.service.BillCertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class BillExpCertCmd implements ICommand<Bill<CbRec>> {
	@Autowired
	private BillCertService billCertService;

	public boolean execute(CommandContext<Bill<CbRec>> context) throws Exception {
		Bill<CbRec> bill = (Bill) context.getSource();
		CbOpt operation = (CbOpt) context.getValue("Operation");
		CbRec rec = bill.getRec();

		this.billCertService.certForExp(rec, operation);
		return false;
	}
}
